import request from '@/axios/request'
import url from '@/axios/url'
const { mesUrl, adminUrl } = url()

// 导出url
export const exportUrl = `${mesUrl}mesTechnologyCharacteristic/export`
// 导出模板
export const templateUrl = `${mesUrl}mesTechnologyCharacteristic/template`
// 导入模板
export const importUrl = `${mesUrl}mesTechnologyCharacteristic/import`

// 列表查询
export function getDataList (params = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/list`,
    method: 'get',
    params
  })
}

// 获取树状结构
export function getTree (params = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/getForTree`,
    method: 'get',
    params
  })
}

// 获取详情
export function getInfo (id = '') {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/` + id,
    method: 'get'
  })
}

// 批量删除
export function submitDelete (data = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/delete`,
    method: 'post',
    data
  })
}

// 新增
export function submitCreate (data = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/create`,
    method: 'post',
    data
  })
}

// 修改
export function submitEdit (data = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/edit`,
    method: 'post',
    data
  })
}

export function getMesSeriesList (params = {}) {
  return request({
    url: `${adminUrl}baseSeries/selectlist`,
    method: 'get',
    params
  })
}

export function getMesModelList (params = {}) {
  return request({
    url: `${adminUrl}baseGoods`,
    method: 'get',
    params
  })
}

export function getMesTechList (params = {}) {
  params['technologyStatus'] = '1';
  return request({
    url: `${mesUrl}mesTechnology`,
    method: 'get',
    params
  })
}

export function getWorkCellList (params = {}) {
  params['technologyStatus'] = '1';
  return request({
    url: `${mesUrl}mesTechnology`,
    method: 'get',
    params
  })
}

export function getTechnologyProcessList (params = {}) {
  return request({
    url: `${mesUrl}mesTechnologyProcess/getDetails`,
    method: 'get',
    params
  })
}

// 查询单位列表
export function getIsReportList () {
  return request({
    url: `${adminUrl}dict/type/report_flag`,
    method: 'get',
  });
}

export function getMesPropertyList (params = {}) {
  return request({
    url: `${mesUrl}mesCharacteristic/pageWithProp`,
    method: 'get',
    params
  })
}

export function getDetailList (params = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/getDetailList`,
    method: 'get',
    params
  })
}
// 导入用户
export function importData (data = {}) {
  return request({
    url: `${mesUrl}mesTechnologyCharacteristic/import`,
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    }
  })
}
